Skip to main content

All Questions

1vote
1answer
54views

Python Prime Search Slower Optimization

I have these 2 version of code. Both are looking for all primes under a certain ceiling value. The first is testing against the set of all odd numbers. The second in testing against the set of all 6k-...
Desmond Rhodes's user avatar
6votes
2answers
104views

Finding consecutive primes matching p, p + 4, p + 6, p + 10, p + 12, p + 16

Someone asked about this question on the main StackOverflow. The full question is: Given a value N, find p such that all of ...
blueteeth's user avatar
12votes
3answers
5kviews

Python π = 1 + (1/2) + (1/3) + (1/4) - (1/5) + (1/6) + (1/7) + (1/8) + (1/9) - (1/10) ...1748 Euler

I wrote this code to show that my reddit post is correct. After the first two terms, the signs are determined as follows: If the denominator is a prime of the form 4m − 1, the sign is positive; if ...
FodderOverflow's user avatar
7votes
4answers
1kviews

Python Prime Testing

This code seems surprisingly fast at checking if a number is prime. ...
Neil A.'s user avatar
9votes
6answers
4kviews

Goldbach’s Conjecture in Python

Input Format Input starts with an integer n (1 ≤ n ≤ 100) indicating the number of cases. The following n lines each contain a test case of a single even number x (4 ≤ x ≤ 32000). Output Format For ...
Gurupad Mamadapur's user avatar

close